﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using NUnit.Framework;

namespace Tests
{
  /// <summary>
  /// Parses text list of palindromes to list of test cases
  /// </summary>
  public class PalindromeListFileParser
  {
    #region private vars
    /// <summary>
    /// Path to palindrome list file
    /// </summary>
    private static readonly string PalindromelistFilePath = "..\\..\\..\\palindromeListFull.txt";
    #endregion

    #region public static methods
    /// <summary>
    /// Parses file
    /// </summary>
    /// <returns>returns list of correct palindromes</returns>
    public static List<TestCaseData> ParseList()
    {
      var palindromeList = new List<TestCaseData>();
      using (var reader = new StreamReader(PalindromelistFilePath))
      {
        string line;
        while ((line = reader.ReadLine()) != null)
        {
          if (line.Trim() != "")
          {
            palindromeList.Add(new TestCaseData(line));
          }
        }
        return palindromeList;
      }
    }
    #endregion

  }
}
